package org.socialgr.impl.domain;

import java.util.Comparator;

public class StringExtendido extends AbstractString{	
	private String value; 

	public StringExtendido (String value){
		this.value = value;
	}
	
	public String getValue(){
		return value.toString();
	}
	
	public boolean equals(Object s){
		//return (value.contains((CharSequence)s.toString())) || 	(s.toString().contains((CharSequence)value)) ;
		return (value.matches("(.*)"+((StringExtendido)s).getValue()+"(.*)")) || (((StringExtendido)s).getValue().matches("(.*)"+value+"(.*)")); 
	}

	@Override
	public int hashCode() {
		int hash=2;
		int h = 17;
        if (h == 0 && value.length() > 0) {
            char val[] = value.toCharArray();

            for (int i = 0; i < value.length(); i++) {
                h = 31 * h + val[i];
            }
            hash = h;
        }
        return h;
	 }
	
	public String toString(){
		return value.toString();
	}
	
	/*@Override
	public int compareTo(StringExtendido o) {
		
		if (this.equals(o))
			return 0;
		
		return -1;

	}

	@Override
	public int compare(StringExtendido o1, StringExtendido o2) {
		return o1.compareTo(o2);
	}*/
}

